/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sp.controller;

import sp.form.Hal7;
import sp.model.B1;
import sp.model.OptionKlasifikasi;
import sp.model.OptionPertanyaan3a;
import sp.model.OptionYaTidak;
import sp.model.Sisipan;

/**
 *
 * @author Thosan Girisona S
 */
public class SisipanController {
    private final Sisipan ssp;
    private final B1 b1;
    private final Hal7 sspView;

    public SisipanController(Sisipan ssp, B1 b1, Hal7 sspView) {
        this.ssp = ssp;
        this.b1 = b1;
        this.sspView = sspView;
    }
    
    public Sisipan Sisipanhasil(){
        ssp.setNksSisipan(b1.getNks());
        ssp.setKlasifikasi(new OptionKlasifikasi(sspView.getPertanyaan1a().getText()));
        ssp.setPertanyaan1(sspView.getPertanyaan1b().getText());
        ssp.setPertanyaan2(new OptionYaTidak(sspView.getPertanyaan2().getText()));
        String opt3a = sspView.getPertanyaan3a().getText();
        if(opt3a.equals("")){opt3a="0";}
        ssp.setPertanyaan3a(new OptionPertanyaan3a(opt3a));
        ssp.setPertanyaan3b(sspView.getPertanyaan3a().getText());
        return ssp;
    }

    Sisipan Sisipannr() {
        ssp.setNksSisipan(b1.getNks());
        return ssp;
    }
}
